package com.crayon.job
{
	import com.crayon.ui.RightMenu;
	import com.crayon.utils.LocalStorage;
	import flash.display.DisplayObjectContainer;
	import flash.display.Sprite;
	import flash.events.Event;
	
	/**
	 * ...
	 * @author 蜡笔
	 */
	public class PartTimeJob extends Sprite
	{
		private var _parent:DisplayObjectContainer;
		private var _Copyright:String = "Crayon";
		private var _isShowName:Boolean;
		private var MAX_USE:int;
		
		public function PartTimeJob(parent:DisplayObjectContainer, useMAX:int = 5, isShowName:Boolean = false)
		{
			this._parent = parent;
			this._isShowName = isShowName;
			this.MAX_USE = useMAX;
			init();
		}
		
		private function init():void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			if (!LocalStorage.getInstall().getBool(_Copyright))
			{
				LocalStorage.getInstall().set(_Copyright, MAX_USE);
			}
			else
			{
				if (int(LocalStorage.getInstall().get(_Copyright)) <= 1)
				{
					addChild(new CopyRightBox(_isShowName));
					RightMenu.getInstance().init(_parent);
					RightMenu.getInstance().hideDefaultMenu();
					RightMenu.getInstance().addItem(String.fromCharCode(35813, 20135, 21697, 26410, 27880, 20876), false); //该产品未注册
					RightMenu.getInstance().addItem(String.fromCharCode(29256, 26435, 20173, 20026, 34593, 31508, 25152, 26377), false); //版权仍为蜡笔所有
				}
				else
				{
					LocalStorage.getInstall().set(_Copyright, int(LocalStorage.getInstall().get(_Copyright)) - 1);
				}
			}
		}
	
	}

}